import { useTransitionSetting } from '@/hooks/setting/useTransitionSetting'
import nProgress from 'nprogress'
import { unref } from 'vue'
import router from '..'
const { getOpenNProgress } = useTransitionSetting()
router.beforeEach(async (to: any) => {
  console.log('before nprogress')
  if (to.meta.loaded) {
    return true
  }
  unref(getOpenNProgress) && nProgress.start()
  return true
})

router.afterEach(async () => {
  unref(getOpenNProgress) && nProgress.done()
  return true
})
